<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>回调函数</title>
</head>
<body>
    
</body>
    <script>
        function a (fn){
            setTimeout(()=>{
               sum = 10;
               fn(sum)     
            },1000)
        }

        a((arr)=>{
            console.log(arr); //10
        })

        //简化抽离
        function b(arr){
            console.log(arr);
        }

        a(b)
    </script>
</html>